//
//  CPYDiscoveryPageSongListModel.m
//  TTMusic
//
//  Created by chenpengyu on 16/4/1.
//  Copyright © 2016年 cpy. All rights reserved.
//

#import "CPYDiscoveryPageSongListModel.h"

@implementation CPYDiscoveryPageSongListModel

- (instancetype)initWithDataSource:(NSDictionary *)dataSource {
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dataSource];
        NSMutableArray *array = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in self.urlList) {
            CPYDiscoveryPageUrlListModel *urlListModel = [[CPYDiscoveryPageUrlListModel alloc] init];
            [urlListModel setValuesForKeysWithDictionary:dic];
            [array addObject:urlListModel];
        }
        self.urlList = [NSMutableArray arrayWithArray:array];
        
        NSMutableArray *array1 = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in self.auditionList) {
            CPYDiscoveryPageAuditionListModel *auditionListModel = [[CPYDiscoveryPageAuditionListModel alloc] init];
            [auditionListModel setValuesForKeysWithDictionary:dic];
            [array1 addObject:auditionListModel];
        }
        self.auditionList = [NSArray arrayWithArray:array1];
        
        NSMutableArray *array2 = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in self.singers) {
            CPYDiscoveryPageSingerModel *singerModel = [[CPYDiscoveryPageSingerModel alloc] init];
            [singerModel setValuesForKeysWithDictionary:dic];
            [array2 addObject:singerModel];
        }
        self.singers = [NSArray arrayWithArray:array2];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"rightKey"]) {
        _rightKeyModel = [[CPYDiscoveryPageRightKeyModel alloc] initWithDataSource:value];
    }
}


@end
